package prototipo.server.logic.item;

import java.util.Map;

import prototipo.server.logic.exception.ExceptionLogic;
import prototipo.server.logic.util.Money;

/**
 * Class to represent a product
 * 
 * @author pablo
 * @since 08/11/2009
 */
public class Product extends Item implements ProductIF {

	private Map<Integer, Short> composition;
	private Money priceV;
	private Money priceC;
	private Money priceP;

	public Product(String name, String description, int amount,
			String unidadeMedida, Map<Integer, Short> composition,
			Money priceV, Money priceC, Money priceP) throws ExceptionLogic {
		super(name, description, amount, unidadeMedida);
		this.setComposition(composition);
		this.setPriceV(priceV);
		this.setPriceC(priceC);
		this.setPriceP(priceP);
	}

	public Map<Integer, Short> getComposition() {
		return composition;
	}

	public void setComposition(Map<Integer, Short> composition) {
		this.composition = composition;
	}

	public Money getPriceV() {
		return priceV;
	}

	public void setPriceV(Money priceV) throws ExceptionLogic {
		if (priceV == null)
			throw new ExceptionLogic("Preco vazio.", new Throwable(
					"Money is null."));
		this.priceV = priceV;
	}

	public Money getPriceC() {
		return priceC;
	}

	public void setPriceC(Money priceC) throws ExceptionLogic {
		if (priceC == null)
			throw new ExceptionLogic("Preco vazio.", new Throwable(
					"Money is null."));
		this.priceC = priceC;
	}

	public Money getPriceP() {
		return priceP;
	}

	public void setPriceP(Money priceP) throws ExceptionLogic {
		if (priceP == null)
			throw new ExceptionLogic("Preco vazio.", new Throwable(
					"Money is null."));
		this.priceP = priceP;
	}
}
